import API from './api';
import http from '../plugin/http';

const getBooks = async (params?: {
    name?: string;
}) => {
    return await http.get(API.BOOKS_GETALL, {params});
};

const addBooks = async (params: {
    name: string;
    intro?: string
}) => {
    return await http.post(API.BOOKS_ADD, params)
};

const updateBook = async (params: {
    id: string;
    name?: string;
    isDelete?: number;
}) => {
    return await http.post(API.BOOKS_UPDATE, params)
};

export default {
    getBooks,
    addBooks,
    updateBook,
}